package com.wj.spingcloud;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

/**
 * @description: 
 * @author: wj
 * @create: 2021/5/12 14:56
 */
@SpringBootApplication
@EnableEurekaClient
// ribbon方式改为随机
//@RibbonClient(name = "CLOUD-PAYMENT-SERVICE", configuration = MySelfRule.class)
public class OrderMainEureka80 {
    private static Logger logger = LoggerFactory.getLogger(OrderMainEureka80.class);

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(OrderMainEureka80.class, args);
        ConfigurableEnvironment environment = applicationContext.getEnvironment();
        String serverPort = environment.getProperty("server.port");
        String contextPath = environment.getProperty("server.servlet.context-path");
        String url = "http://127.0.0.1:"+serverPort+contextPath+"/doc.html";
        logger.info("项目启动成功，swagger访问地址是：{}",url);
    }
}